import { createCrudApi } from '@/utils/apiFactory';
import request from '@/utils/unirequest';
import type { IPageResponse } from '@/type/common';
import type { ISysHrRecruitRequestBill, ISysHrRecruitRequestBillView, ISysHrRecruitRequestBillVm, ISysHrRecruitRequestBillEntryView } from './interface';

export default function SysHrRecruitRequestBillApi() {
  // 基础CRUD用工厂生成
  const baseCrud = createCrudApi<
    ISysHrRecruitRequestBillView,
    ISysHrRecruitRequestBillVm,
    ISysHrRecruitRequestBill
  >('/api/SysHrRecruitRequestBill');

  return {
    ...baseCrud,
    // 额外的特殊接口

    // 查询招聘需求明细列表
    async searchList(data: { RecruitRequestBillId?: string, Limit: number, Page: number }): Promise<IPageResponse<ISysHrRecruitRequestBillEntryView[]>> {
      return await request.post('/api/SysHrRecruitRequestBillEntry/Search', data);
    },

    // 审核接口
    async approve(data: ISysHrRecruitRequestBillVm): Promise<ISysHrRecruitRequestBill> {
      return await request.post('/api/SysHrRecruitRequestBill/approve?tag=', data);
    },
  };
}